#ifndef COMPUTESHADEROBJECTSCB_H
#define COMPUTERSHADEROBJETSCB_H

#include "Vec3.h"
#include "CSCamera.h"
#include <d3d11.h>

struct CSRay
{
	CSRay() {}
	CSRay(const Vec3f& orig, const Vec3f& dir)
	{
		origin = orig;
		direction = dir;
	}

	Vec3f origin;
	float pad1;
	Vec3f direction;
	float pad2;
};

// object data start
struct CSColour
{
	CSColour() {}
	CSColour(float r, float g, float b, float a)
	{
		red = r;
		green = g;
		blue = b;
		alpha = a;
	}
	
	float red;
	float green;
	float blue;
	float alpha;
	float gloss;
	Vec3f pad1;
};

struct CSSphere
{
	float FindIntersection() {}
	Vec3f GetNormalAt() {}

	CSColour colour;
	Vec3f position;
	float pad1;
	float radius;
	Vec3f pad2;
};

struct CSTriangle
{
	CSTriangle() {}
	CSTriangle(const Vec3f& A, const Vec3f& B, const Vec3f& C, const CSColour& col)
	{
		colour = col;
		pointA = A;
		pointB = B;
		pointC = C;

		Vec3f CToA(pointC - pointA);
		Vec3f BToA(pointB - pointA);

		m_normal.CrossProduct(CToA, BToA);
		m_normal = m_normal.Normalise();
	}

	float FindIntersection() {}
	Vec3f GetNormalAt() {}
	
	CSColour colour;
	Vec3f pointA;
	float pad1;
	Vec3f pointB;
	float pad2;
	Vec3f pointC;
	float pad3;
	Vec3f m_normal;
	float pad4;
};

// lighting
struct CSLight
{
	Vec3f position;
	float pad1;
	CSColour colour;
};

struct CSObjects
{
	CSSphere spheres[2];
	CSTriangle triangles[2];
};
// object data end

struct CSBuffer
{
	CSObjects objects;
	CSCamera camera;
	CSLight light;
};

// init debug buffer
struct CSDebugBuffer
{
	CSTriangle triangles[2];
};

#endif //COMPUTESHADEROBJECTSCB_H